package io.datajek.springbasics.movierecommendersystem.Lesson9;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

@Component
//@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)     //作用域从Singleton变为Prototype
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE,proxyMode = ScopedProxyMode.TARGET_CLASS)
public class Movie {
//    用于计数创建的实例
    private static int instatnces = 0;

    private int id;
    private String name;        //电影名称
    private String genre;       //流派、类型
    private String producer;    //制作人

    public Movie(){
        super();
        instatnces++;
        System.out.println("Movie constructor called");
    }

    public static int getInstances(){
        return Movie.instatnces;
    }

    public double movieSimilarity(int movie1,int movie2){

        double similarity = 0.0;
//        如果genre相同，相似度上加0.3
//        如果producer相同，相似度上加0.5
        return similarity;
    }
}
